package com.jsmile.cloud.authc.sys.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.jsmile.cloud.authc.api.req.sys.ReqSysRoleUpdate;

import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author 龚亮
 * @version 1.0
 * @desc 为了薪资破万，还是睡一会儿吧...!
 * @date 2019年11月01日 08:52:39
 */
@ApiModel
@Data
@TableName("t_op_sys_role")
public class SysRole extends Model<SysRole> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty(value = "角色名称")
    private String roleName;
    @ApiModelProperty(value = "角色code")
    private String roleCode;
    @ApiModelProperty(value = "是否可用 1是 0否")
    private Integer enable;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "创建时间")
    private java.util.Date createTime;
    @ApiModelProperty(value = "创建者")
    private String createBy;
    @ApiModelProperty(value = "更新时间")
    private java.util.Date updateTime;
    @ApiModelProperty(value = "更新者  ")
    private String updateBy;
    @ApiModelProperty(value = "所属系统")
    private String sysNo;
    @ApiModelProperty(value = "租户id")
    private Long tenantId;
    @TableLogic
    @ApiModelProperty(value = "是否删除 1是 0否")
    private Integer delFlag;

    public static SysRole create(ReqSysRoleUpdate reqSysRoleUpdate) {
        SysRole sysRole = BeanUtil.toBean(reqSysRoleUpdate, SysRole.class);
        sysRole.setId(reqSysRoleUpdate.getRoleId());
        return sysRole;
    }
}
